﻿using System;
using Sunny.UI;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using ClassLibrary;

namespace Forms.UserController
{
    public partial class Orderbox : UIUserControl
    {
        Order order = new Order();
        GoodService goodService = new GoodService();
        public Orderbox(Order order)
        {
            InitializeComponent();
            Color userColor = MainForm.MainForm.userColor;
            UIStyles.InitColorful(userColor, Color.White);
            this.order = order;
            IDLabel.Text = order.OrderID;
            TimeLabel.Text = order.OrderTime.ToString();
            SumLabel.Text = order.Sum.ToString() + "¥";
            panel.AutoScroll = true;
            int i = 1;
            List<Good> goods = new List<Good>();//记录当前订单的商品列表
            goods = goodService.GetGoodByOrderID(order.OrderID);
            GoodsLabel.Text = "";
            foreach (Good good in goods)
            {
                GoodsLabel.Text += "商品" + i + "：\n";
                GoodsLabel.Text += "名称：" + good.GoodName + "\n数量:" + good.GoodCount + " 单价：" + good.GoodPrice + "¥\n\n";
                i++;
            }
        }

        private void uiLabel4_Click(object sender, EventArgs e)
        {

        }
    }
}
